#!/usr/bin/bash
#
# $Id: $
#

for PackageDir in Packages/iconv*               \
                  Packages/zlib*                \
                  Packages/libxml2*             \
                  Packages/antlr*
do
    if [ -d "$PackageDir" ]
    then
        echo -n "Removing $PackageDir ... "
        rm -rf "$PackageDir"
        [ $? -ne 0 ] && echo Failed ... || echo Ok
    fi
done

for Package in iconv-1.9.2.win32.zip            \
               zlib-1.2.5.win32.zip             \
               libxml2-2.7.7.win32.zip          \
               antlr3.2_cpp_parser4.1.0.zip
do
    echo -n "Unpacking $Package ... "
    unzip -q "Packages/$Package" -d Packages

    [ $? -ne 0 ] && echo Failed ... || echo Ok
done


echo -n "Copy zlib1.dll to cppParser\Debug ..."
mkdir cppParser/Debug
cp ./Packages/zlib-1.2.5/bin/zlib1.dll cppParser/Debug
chmod +x cppParser/Debug/zlib1.dll
[ $? -ne 0 ] && echo Failed ... || echo Ok
chmod +x Packages/*/bin/*.dll
